import { getAreaObj } from '@/utils/util'

export const detailConfig: any = {
	label: '运营记录详情',
	inline: false,
	showBtn: false,
	labelPosition: 'left',
	labelWidth: '200px',
	column: [
		//-------------------- 运营记录 ----------------
		{
			label: '机构运营补贴花名册',
			prop: 'table',
			type: 'uplaod',
			labelPosition: 'top',
			showFileList: false,
			limit: 4,
			multiple: true,
			span: 24,
		},
	],
}
const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{ label: '姓名', prop: 'oldmanName', type: 'uplaod' },
		{ label: '身份证号', prop: 'idCard',width:200 },
		{ label: '户籍地区', prop: 'cr_areas_name',width:400 },
		{ label: '入院时间', prop: 'checkinDate',width:200 },
		{ label: '出院时间', prop: 'checkoutDate',width:200 },
		{ label: '房间号', prop: 'roomCode' },
		{ 
			label: '老人护理类别', 
			prop: 'nursingType',
			propName:"nursingTypeLabel",
			code:'NURSE_TYPE',
			api:'getDictItemList',
			type:'remoteSelect'
		},
		{ 
			label: '能力等级（市标）', 
			prop: 'abilityLevel',
			propName:'abilityLevelLabel',
			api:'getDictItemList',
			code:"ABILITY_LEVEL_CITY_STANDARD",
			type:"remoteSelect"
		},
		{
			label: '入住协议',
			prop: 'checkinAgreementImgs',
			width:300,
			custome:'file',
		},
		{
			label: '老人身份证',
			prop: 'idCardImgs',
			width:300,
			custome:'file',
		},
		{
			label: '户口簿',
			prop: 'householdImgs',
			width:300,
			custome:'file',
		},
		{
			label: '老人照片',
			prop: 'oldmanPhoto',
			width:300,
			custome:'file',
		},
		{
			label: '健康检查资料',
			prop: 'healthExamineImgs',
			width:300,
		    custome:'file'
		},
		{ label: '监护人姓名', prop: 'guardianName' },
		{ label: '监护人联系方式', prop: 'guardianPhone',width:200 },
		{ 
			label: '监护人和老人关系',
			prop: 'guardianRelation',
			propName:'guardianRelationLabel',
			code:'ELDERLY_RELATIONSHIP',
			api:'getDictItemList',
			type:'remoteSelect'
		},
		// {
		// 	prop: 'menu',
		// 	width: 120,
		// 	fixed: 'right',
		// },
	],
}
export const formConfig = {
	label: '数据管理设置',
	prop: 'base0',
	inline: false,
	showBtn: true,
	labelPosition: 'left',
	column: detailConfig.column,
}
export const baseConfig: any = {
	pageName: '五类老人入住养老机构补贴花名册',
	addLabel: '添加',
	dictcodes: ['NURSE_TYPE','RESULT','ABILITY_LEVEL_CITY_STANDARD','ELDERLY_RELATIONSHIP'],
	rowKey: 'id',
	tipLabel: 'batch',
	api: {
		index: 'dpOrgOperateSubsidyRoster_page',
		// edit: 'view_dpOperateRecord_edit',
		// delete: 'view_dpOperateRecord_del',
	},
	auth: {
		index: 'view_dpOrgOperateSubsidyRoster_page',
		// edit: 'view_dpOperateRecord_edit',
		// delete: 'view_dpOperateRecord_del',
	},
	// menuBtn: [
	// 	{
	// 		icon: 'editor',
	// 		label: '查看详情',
	// 		type: 'primary',
	// 		operate: 'detail',
	// 		auth: '',
	// 		text: true,
	// 		show: true,
	// 	},
	// ],
	dialogConfig: {
		width: '65%',
	},
	tableConfig,
	formConfig,
	detailConfig,
	onLoadFormate: async (arr) => {
		console.log('列表', arr)
		const tableData = arr.map((item) => {
			let cr_areas_name = getAreaObj(item, 'cr')
			return {
				...item,
				cr_areas_name,
			}
		})
		return Promise.resolve(Object.freeze(tableData))
	},
}
